# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

cc_library(
    name = "app_db_entry_builder",
    testonly = True,
    srcs = ["app_db_entry_builder.cc"],
    hdrs = ["app_db_entry_builder.h"],
    deps = [
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:str_format",
        "@com_google_absl//absl/types:optional",
    ],
)

cc_test(
    name = "app_db_entry_builder_test",
    srcs = ["app_db_entry_builder_test.cc"],
    deps = [
        ":app_db_entry_builder",  # fixdeps: keep
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "p4runtime_component_test_fixture",
    testonly = True,
    srcs = ["p4runtime_component_test_fixture.cc"],
    hdrs = ["p4runtime_component_test_fixture.h"],
    deps = [
        ":p4runtime_grpc_service",
        "//gutil/gutil:status_matchers",
        "//p4_pdpi:ir",
        "//p4_pdpi:ir_cc_proto",
        "//p4_pdpi:p4_runtime_session",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//sai_p4/instantiations/google:instantiations",
        "//sai_p4/instantiations/google:sai_p4info_cc",
	"@com_github_grpc_grpc//:grpc++",
        "@com_github_p4lang_p4runtime//:p4info_cc_proto",
        "@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "p4runtime_grpc_service",
    testonly = True,
    srcs = ["p4runtime_grpc_service.cc"],
    hdrs = ["p4runtime_grpc_service.h"],
    deps = [
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/sonic:fake_packetio_interface",
        "//p4rt_app/sonic:redis_connections",
        "//p4rt_app/sonic/adapters:fake_consumer_notifier_adapter",
        "//p4rt_app/sonic/adapters:fake_notification_producer_adapter",
        "//p4rt_app/sonic/adapters:fake_producer_state_table_adapter",
        "//p4rt_app/sonic/adapters:fake_sonic_db_table",
        "//p4rt_app/sonic/adapters:fake_table_adapter",
        "//p4rt_app/sonic/adapters:fake_warm_boot_state_adapter",
        "@com_github_grpc_grpc//:grpc++",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/random",
        "@com_google_absl//absl/random:distributions",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "p4runtime_request_helpers",
    testonly = True,
    srcs = ["p4runtime_request_helpers.cc"],
    hdrs = ["p4runtime_request_helpers.h"],
    deps = [
        "//gutil/gutil:proto",
        "//p4_pdpi:ir_cc_proto",
        "//p4_pdpi:pd",
        "//sai_p4/instantiations/google:sai_pd_cc_proto",
        "@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
    ],
)
